// 统一管理项目 用户相关的接口
import request from "@/utils/request";


// 项目用户相关的请求地址
enum API {
    GET_ADMIN_URL = '/admin',
    ADD_ADMIN_URL = '/admin/add',
    UPDATE_ADMIN_URL = '/admin/update',
    DELETE_ADMIN_ID_URL = '/admin/delete',
    DELETE_ADMIN_IDS_URL = '/admin/deletes/',
}

// 获取用户列表
export const reqSearchAdmin = (params: any) => {
    return request.post(API.GET_ADMIN_URL, params, { headers: { 'Content-Type': 'application/json' } })
}

// 添加用户
export const reqAddAdmin = (params: any) => {
    return request.post(API.ADD_ADMIN_URL, params, { headers: { 'Content-Type': 'application/json' } })
}

// 更新用户
export const reqUpdateAdmin = (params: any) => {
    return request.post(API.UPDATE_ADMIN_URL, params, { headers: { 'Content-Type': 'application/json' } })
}

// 删除用户 -- 单个
export const reqDeleteAdminById = (id: number) => {
    return request.delete(API.DELETE_ADMIN_ID_URL + `/${id}`)
}

// 删除用户 -- 批量
export const reqDeleteAdminByIds = (ids: number[]) => {
    return request.delete(API.DELETE_ADMIN_IDS_URL, { data: ids })
}
